<?php
$opleidingen = array(1 => "Informatica",
						  "Bedrijfs. Informatica",
						  "Techn. Informatica",
						  "CMD",
						  "IDM");
						  
function prep_Select($toSelect, $iterator) {
	if($iterator == $toSelect) {
		$selected = "selected='selected'";
	} else {
		$selected = "";
	}
	return $selected;
}

function geefValue($id) {
	return isset($_GET["$id"]) ? $_GET["$id"] : "";
}
?>
<form action="index.php" method="get">
	<table>
	<tr>
		<td>Functie</td>
		<td><input name="functie" value='<?php echo geefValue('functie'); ?>' /></td>
	</tr>
	<tr>
		<td>Sector</td>
		<td><input name="sector" value='<?php echo geefValue('sector'); ?>' /></td>
	</tr>
	<tr>
		<td>Opleiding</td>
		<td>
		<select name='opleiding'>
            <option value="">- Selecteer -</option>
				<?php	
					for($i = 1; $i < 6; $i++) {
						$select = prep_Select(geefValue('opleiding'), $i);
						echo "<option $select value='$i'>$opleidingen[$i]</option>";
					}
				?>
        </select>
		</td>
	</tr>
	<tr>
		<td>Jaar</td>
		<td>
		<select name='jaar' class='small'>
			<option value="">- Selecteer -</option>
			<?php	
				for($i = 1; $i < 5; $i++) {
					$select = prep_Select(geefValue('jaar'), $i);
					echo "<option $select value='$i'>$i</option>";
				}
			?>
        </select>
		</td>
	</tr>
	<tr>
	<td><input type="hidden" name="id" value="uitgebreidzoekresult" />
	<input type="hidden" name="type" value="student" /></td>
	<td><input class="fixed" type="submit" value="Zoeken" class="submit" /></td>
	</tr>
	</table>
</form>